<template>
  <div class="member-card">

    <!-- 公司logo -->
    <div class="logo" v-if="company_info!==''">
      <span v-for="(item,index) of company_info.label_list" :key="index">{{item}}</span>
      <img :src="company_info.logo_url" alt="" mode="aspectFill">
      <div>{{company_info.company_name}}</div>
    </div>
    <!-- 公司logo end -->

    <!-- 公司详情 -->
    <div class="item-wrapper" v-if="company_info!==''">
      <div class="item">
        <div class="item-name">法定代表人:</div>
        <div class="item-content">{{company_info.legal_person}}</div>
      </div>
      <div class="item">
        <div class="item-name">所属行业:</div>
        <div class="item-content">{{company_info.industry}}</div>
      </div>
      <div class="item">
        <div class="item-name">企业地址:</div>
        <div class="item-content textarea">{{company_info.province}}{{company_info.city}}{{company_info.area}}{{company_info.company_address}}</div>
      </div>
      <div class="item">
        <div class="item-name">联系方式:</div>
        <div class="item-content">{{company_info.contact}}</div>
      </div>
      <div class="item">
        <div class="item-name">企业简介:</div>
        <div class="item-content textarea">{{company_info.desc}}</div>
      </div>
    </div>
    <!-- 公司详情 end -->

    <!-- 宣传信息 -->
    <div class="conduction" v-if="company_info!==''">
      <video :src="company_info.video_url" controls v-if="company_info.video_url"></video>
      <img :src="img.img_url" alt="" mode="widthFix" @click="prevImg(img.img_url,company_info.img_url_list)" v-for="(img,index) of company_info.img_url_list" :key="index">
    </div>
  </div>
</template>

<script>
import { mapActions } from 'vuex';
import wxParse from 'mpvue-wxparse'

export default {
  data(){
    return{
      company_info:'',
      phone:'',
      user_company_list:'',
      user_company_list_flag:true,
    }
  },
  components:{
    wxParse
  },
  onLoad(options){
    this.company_info='';
    this.id = options.id
    this.reqVipCompanyList();
  },
  methods:{
    ...mapActions(['reqInsertVipVisitorRecord']),
    async reqVipCompanyList(){
      let params = {
        id: this.id,
      };
      let res = await this.$api.getVipCompanyList(params);
      wx.stopPullDownRefresh()
      if(res.data.level == "success"){
        let data = res.data.data;
        this.company_info = data[0];
        console.log(this.company_info,7777)
      }else{
        wx.showToast({
          title: '获取首页会员企业列表失败',
          icon: 'none',
          duration: 1000
        })
      }
    }, 
    call(phone,userId){
      var This = this;
      var obj = {
        userId:userId,
        type:'contact'
      }
      wx.makePhoneCall({
        phoneNumber: phone,
        success(){
          This.reqInsertVipVisitorRecord(obj);
        }
      })
    },
    prevImg(current,urls){
     let arr=urls.map(item=>item.img_url)
      wx.previewImage({
        current: current, // 当前显示图片的http链接
        urls: arr, // 需要预览的图片http链接列表
        fail:err=>{console.log(err)}
      })
    }
  },
}
</script>

<style lang="scss" scoped>
.member-card{
  min-height: 100vh;
  background-color: #f1f1f1;
  padding-bottom: 100rpx;
  .member-card-top{
    height: 400rpx;
    padding: 0 50rpx;
    background-image: url(../../../../static/images/menber_bg.png);
    background-repeat: no-repeat;
    background-size: 100%;
    position: relative;
    .menber-card-top-info{
      width: 100%;
      height: 310rpx;
      border-radius: 16rpx;
      background-color: #fff;
      box-shadow: 0 0 2px #cccccc;
      padding: 35rpx 41rpx 48rpx 36rpx;
      position: relative;
      top: 88rpx;
      display: flex;
      .member-card-top-l{
        width: 117rpx;
        height: 225rpx;
        .member-card-avatar{
          width: 117rpx;
          height: 117rpx;
          border-radius: 50%;
        }
        .member-card-name{
          margin-top: 25rpx;
          text-align: center;
          font-size: 26rpx;
        }
        .member-card-position{
          margin-top: 26rpx;
          display: flex;
          align-items: center;
          text-align: center;
          i{
            width: 58rpx;
            height: 32rpx;
            color: #333232;
            background-image: url(../../../../static/images/vip.png);
            background-repeat: no-repeat;
            background-size: 100%;
            background-position: center center;
            margin-right: 4rpx
          }
          div{
            width:100%;
            font-size: 22rpx;
            color: #696767;
          }
        }
      }
      .member-card-top-r{
        width: 464rpx;
        height: 225rpx;
        .member-card-company{
          margin-top: 11rpx;
          margin-left: 26rpx;
          font-size: 26rpx;
        }
        .member-card-mid{
          margin-top: 20rpx;
          margin-left: 26rpx;
          font-size: 26rpx;
          display: flex;
          .position{
            margin-right: 25rpx;
          }
          .industry{
            font-size: 22rpx;
            color: #898887;
          }
        }
        .member-card-call{
          display: flex;
          margin-top: 24rpx;
          margin-left: 13rpx;
          i{
            width: 25rpx;
            height: 40rpx;
            margin-right: 10rpx;
            background-image: url(../../../../static/images/mobile1.png);
            background-repeat: no-repeat;
            background-size: 100%;
            background-position: center center;
          }
          .member-card-call-number{
            font-size: 24rpx;
            color: #898887;
            line-height: 40rpx;
          }
        }
        .member-card-address{
          display: flex;
          margin-top: 21rpx;
          margin-left: 10rpx;
          i{
            width: 42rpx;
            height: 45rpx;
            margin-right: 10rpx;
            background-image: url(../../../../static/images/position.png);
            background-repeat: no-repeat;
            background-size: 100%;
            background-position: center center;
          }
          .member-card-address-text{
            font-size: 24rpx;
            color: #898887;
            line-height: 40rpx;
          }
        }
      }
    }
  }
  .menber-card-bottom{
    padding: 0 50rpx;
    .menber-card-intro{
      margin-top: 30rpx;
      background-color: #fff;
      box-shadow: 0 0 2px #cccccc;
      border-radius: 16rpx;
      padding: 12rpx 52rpx 48rpx;
      display: flex;
      flex-direction: column;
      align-items: center;
      .menber-card-intro-title{
        width: 152rpx;
        height: 49rpx;
        border-radius: 12rpx;
        background-color: #fd8b0e;
        color: #fff;
        text-align: center;
        line-height: 49rpx;
        font-size: 24rpx;
      }
      .menber-card-intro-conntent{
        margin-top: 8rpx;
        line-height: 40rpx;
        font-size: 24rpx;
        color: #4a4b4b;
      }
    }
    .menber-card-company-list{
      margin-top: 26rpx;
      background-color: #fff;
      box-shadow: 0 0 2px #cccccc;
      border-radius: 16rpx;
      padding: 11rpx 46rpx 25rpx 28rpx;
      display: flex;
      flex-direction: column;
      align-items: center;
      .menber-card-company-name{
        width: 100%;
        display: flex;
        padding-bottom: 6rpx;
        border-bottom: 1px solid #bcbdbe;
        i{
          width: 48rpx;
          height: 48rpx;
          background-image: url(../../../../static/images/qiye.png);
          background-repeat: no-repeat;
          background-size: 100%;
          background-position: center center;
        }
        span{
          height: 48rpx;
          line-height: 48rpx;
          margin-left: 10rpx;
          color: #4a4b4b;
          font-size: 26rpx;
        }
      }
      .menber-card-company-content{
        padding: 7rpx 13rpx 0rpx;
        font-size: 24rpx;
        color: #858686;
        line-height: 42rpx;
      }
      .menber-card-company-more{
        color: #cbcdce;
        font-size: 24rpx;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        i{
          width: 36rpx;
          height: 19rpx;
          margin-top: 8rpx;
          background-image: url(../../../../static/images/jiantou.png);
          background-repeat: no-repeat;
          background-size: 100%;
          background-position: center center;
        }
      }
    }
  }
  .menber-call-btn{
    position: fixed;
    left: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 72rpx;
    background-color: #2aa7e1;
    i{
      width: 44rpx;
      height: 44rpx;
      background-image: url(../../../../static/images/dianhua2.png);
      background-repeat: no-repeat;
      background-size: 100%;
      background-position: center center;
      margin-right: 18rpx;
    }
    span{
      color: #fff;
      font-size: 34rpx;
    }
  }
}

//logo
.logo{
  position: relative;
  top:10px;
  padding:40px 0;
  width: calc(100% - 20px);
  margin-left:10px;
  border-radius: 10px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  img{
    width: 60px;
    height: 60px;
    border-radius: 50%;
  }
  div{
    margin-top:10px;
  }
  span{
    position: absolute;
    border-radius: 10px;
    padding:5px;
    display: inline-block;
    color:#fff;
    font-size: 12px;
  }
  span:nth-child(1){
    top:10px;
    left:20px;
    border:1px solid #eee;
    background: #4aa0e2
  }
  span:nth-child(2){
    top:20px;
    right:30px;
    background: #eea95e
  }
  span:nth-child(3){
    top:100px;
    left:5px;
    background: #5fc971
  }
  span:nth-child(4){
    top:70px;
    right:10px;
    background: #c78fdd
  }
  // background: #e3689c
  // #b59cbe
 
}


//详情列
.item-wrapper{
  width: calc(100% - 20px);
  margin-left:10px;
  margin-top:20px;
  border-radius: 10px;
  background: #fff;
  padding:20px 5px;
  .item{
    display: flex;
    flex-wrap: wrap;
    margin:20px 0;
    padding:5px 0;
    border-bottom:1px solid #eee;

    .item-name{
      width: 120px;
    }
    .textarea{
      margin-top:10px;
    }
  }
}


//宣传信息
.conduction{
  width: calc(100% - 20px);
  margin-left:10px;
  margin-top:20px;
  border-radius: 10px;
  padding:5px;
  background: #fff;
  video{
    width:100%
  }
  img{
    width: 100%;
    max-height: 300px;
    margin:10px 0;
  }
}
</style>